package com.iflytek.jobs.admin.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.iflytek.jobs.service.domain.ResumeLog;
import com.iflytek.jobs.service.service.IResumeLogService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.service.ISysDeptService;

/**
 * 简历修改记录Controller
 * 
 * @author chenhs
 * @date 2023-04-17
 */
@RestController
@RequestMapping("/jobs/resume/log")
public class ResumeLogController extends BaseController
{
    @Autowired
    private IResumeLogService resumeLogService;
   

    /**
     * 查询简历修改记录列表
     */
    @GetMapping("/list")
    public TableDataInfo list(ResumeLog bizResumeLog)
    {
        startPage();
        List<ResumeLog> list = resumeLogService.selectResumeLogList(bizResumeLog);
        return getDataTable(list);
    }

    /**
     * 导出简历修改记录列表
     */
    @Log(title = "简历修改记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @PreAuthorize("@ss.notRole('demo')")
    public void export(HttpServletResponse response, ResumeLog bizResumeLog)
    {
        List<ResumeLog> list = resumeLogService.selectResumeLogList(bizResumeLog);
        ExcelUtil<ResumeLog> util = new ExcelUtil<ResumeLog>(ResumeLog.class);
        util.exportExcel(response, list, "简历修改记录数据");
    }

    /**
     * 获取简历修改记录详细信息
     */
    @GetMapping(value = "/{rlId}")
    public AjaxResult getInfo(@PathVariable("rlId") Long rlId)
    {
        return success(resumeLogService.selectResumeLogByRlId(rlId));
    }

    /**
     * 新增简历修改记录
     */
    @PostMapping
    @PreAuthorize("@ss.notRole('demo')")
    public AjaxResult add(@RequestBody ResumeLog bizResumeLog)
    {
    	bizResumeLog.setCreateBy(super.getUsername());
        return toAjax(resumeLogService.insertResumeLog(bizResumeLog));
    }

    /**
     * 修改简历修改记录
     */
    @Log(title = "简历修改记录", businessType = BusinessType.UPDATE)
    @PutMapping
    @PreAuthorize("@ss.notRole('demo')")
    public AjaxResult edit(@RequestBody ResumeLog bizResumeLog)
    {
        return toAjax(resumeLogService.updateResumeLog(bizResumeLog));
    }

    /**
     * 删除简历修改记录
     */
    @Log(title = "简历修改记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{rlIds}")
    @PreAuthorize("@ss.notRole('demo')")
    public AjaxResult remove(@PathVariable Long[] rlIds)
    {
        return toAjax(resumeLogService.deleteResumeLogByRlIds(rlIds));
    }

   
}
